package com.es.disped.dao.mapper;

import com.es.disped.dao.model.CourseTemplate;
import com.es.disped.dao.model.CourseTemplateExample;
import java.util.List;

import org.apache.ibatis.annotations.CacheNamespace;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.DeleteProvider;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.InsertProvider;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Result;
import org.apache.ibatis.annotations.Results;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.SelectProvider;
import org.apache.ibatis.annotations.Update;
import org.apache.ibatis.annotations.UpdateProvider;
import org.apache.ibatis.type.JdbcType;

/**
 * @author Anson<br>
 *	Copyright by EasyShare 2019<br>
 *  
 *  All right reserved<br>
 *
 *  Created on 2019年7月27日 下午8:45:53<br>
 *  名称：CourseTemplateMapper.java<br>
 *  描述：课程模板模型<br>
 */
//@CacheNamespace(implementation=(com.es.disped.dao.cache.RedisCache.class),size=512,flushInterval=60000)
public interface CourseTemplateMapper {
    /**
     * This method was generated by MyBatis Generator.
     * This method corresponds to the database table course_template
     *
     * @mbg.generated Thu Jul 04 11:26:06 CST 2019
     */
    @SelectProvider(type=CourseTemplateSqlProvider.class, method="countByExample")
    long countByExample(CourseTemplateExample example);

    /**
     * This method was generated by MyBatis Generator.
     * This method corresponds to the database table course_template
     *
     * @mbg.generated Thu Jul 04 11:26:06 CST 2019
     */
    @DeleteProvider(type=CourseTemplateSqlProvider.class, method="deleteByExample")
    int deleteByExample(CourseTemplateExample example);

    /**
     * This method was generated by MyBatis Generator.
     * This method corresponds to the database table course_template
     *
     * @mbg.generated Thu Jul 04 11:26:06 CST 2019
     */
    @Delete({
        "delete from course_template",
        "where template_id = #{templateId,jdbcType=CHAR}"
    })
    int deleteByPrimaryKey(String templateId);

    /**
     * This method was generated by MyBatis Generator.
     * This method corresponds to the database table course_template
     *
     * @mbg.generated Thu Jul 04 11:26:06 CST 2019
     */
    @Insert({
        "insert into course_template (template_id, template_name, ",
        "course_id, course_name, ",
        "level_id, level_name, ",
        "course_type, min_age, ",
        "max_age, course_period, ",
        "course_book, course_valid)",
        "values (#{templateId,jdbcType=CHAR}, #{templateName,jdbcType=VARCHAR}, ",
        "#{courseId,jdbcType=CHAR}, #{courseName,jdbcType=VARCHAR}, ",
        "#{levelId,jdbcType=CHAR}, #{levelName,jdbcType=VARCHAR}, ",
        "#{courseType,jdbcType=VARCHAR}, #{minAge,jdbcType=INTEGER}, ",
        "#{maxAge,jdbcType=INTEGER}, #{coursePeriod,jdbcType=INTEGER}, ",
        "#{courseBook,jdbcType=VARCHAR}, #{courseValid,jdbcType=INTEGER})"
    })
    int insert(CourseTemplate record);

    /**
     * This method was generated by MyBatis Generator.
     * This method corresponds to the database table course_template
     *
     * @mbg.generated Thu Jul 04 11:26:06 CST 2019
     */
    @InsertProvider(type=CourseTemplateSqlProvider.class, method="insertSelective")
    int insertSelective(CourseTemplate record);

    /**
     * This method was generated by MyBatis Generator.
     * This method corresponds to the database table course_template
     *
     * @mbg.generated Thu Jul 04 11:26:06 CST 2019
     */
    @SelectProvider(type=CourseTemplateSqlProvider.class, method="selectByExample")
    @Results({
        @Result(column="template_id", property="templateId", jdbcType=JdbcType.CHAR, id=true),
        @Result(column="template_name", property="templateName", jdbcType=JdbcType.VARCHAR),
        @Result(column="course_id", property="courseId", jdbcType=JdbcType.CHAR),
        @Result(column="course_name", property="courseName", jdbcType=JdbcType.VARCHAR),
        @Result(column="level_id", property="levelId", jdbcType=JdbcType.CHAR),
        @Result(column="level_name", property="levelName", jdbcType=JdbcType.VARCHAR),
        @Result(column="course_type", property="courseType", jdbcType=JdbcType.VARCHAR),
        @Result(column="min_age", property="minAge", jdbcType=JdbcType.INTEGER),
        @Result(column="max_age", property="maxAge", jdbcType=JdbcType.INTEGER),
        @Result(column="course_period", property="coursePeriod", jdbcType=JdbcType.INTEGER),
        @Result(column="course_book", property="courseBook", jdbcType=JdbcType.VARCHAR),
        @Result(column="course_valid", property="courseValid", jdbcType=JdbcType.INTEGER)
    })
    List<CourseTemplate> selectByExample(CourseTemplateExample example);

    /**
     * This method was generated by MyBatis Generator.
     * This method corresponds to the database table course_template
     *
     * @mbg.generated Thu Jul 04 11:26:06 CST 2019
     */
    @Select({
        "select",
        "template_id, template_name, course_id, course_name, level_id, level_name, course_type, ",
        "min_age, max_age, course_period, course_book, course_valid",
        "from course_template",
        "where template_id = #{templateId,jdbcType=CHAR}"
    })
    @Results({
        @Result(column="template_id", property="templateId", jdbcType=JdbcType.CHAR, id=true),
        @Result(column="template_name", property="templateName", jdbcType=JdbcType.VARCHAR),
        @Result(column="course_id", property="courseId", jdbcType=JdbcType.CHAR),
        @Result(column="course_name", property="courseName", jdbcType=JdbcType.VARCHAR),
        @Result(column="level_id", property="levelId", jdbcType=JdbcType.CHAR),
        @Result(column="level_name", property="levelName", jdbcType=JdbcType.VARCHAR),
        @Result(column="course_type", property="courseType", jdbcType=JdbcType.VARCHAR),
        @Result(column="min_age", property="minAge", jdbcType=JdbcType.INTEGER),
        @Result(column="max_age", property="maxAge", jdbcType=JdbcType.INTEGER),
        @Result(column="course_period", property="coursePeriod", jdbcType=JdbcType.INTEGER),
        @Result(column="course_book", property="courseBook", jdbcType=JdbcType.VARCHAR),
        @Result(column="course_valid", property="courseValid", jdbcType=JdbcType.INTEGER)
    })
    CourseTemplate selectByPrimaryKey(String templateId);

    /**
     * This method was generated by MyBatis Generator.
     * This method corresponds to the database table course_template
     *
     * @mbg.generated Thu Jul 04 11:26:06 CST 2019
     */
    @UpdateProvider(type=CourseTemplateSqlProvider.class, method="updateByExampleSelective")
    int updateByExampleSelective(@Param("record") CourseTemplate record, @Param("example") CourseTemplateExample example);

    /**
     * This method was generated by MyBatis Generator.
     * This method corresponds to the database table course_template
     *
     * @mbg.generated Thu Jul 04 11:26:06 CST 2019
     */
    @UpdateProvider(type=CourseTemplateSqlProvider.class, method="updateByExample")
    int updateByExample(@Param("record") CourseTemplate record, @Param("example") CourseTemplateExample example);

    /**
     * This method was generated by MyBatis Generator.
     * This method corresponds to the database table course_template
     *
     * @mbg.generated Thu Jul 04 11:26:06 CST 2019
     */
    @UpdateProvider(type=CourseTemplateSqlProvider.class, method="updateByPrimaryKeySelective")
    int updateByPrimaryKeySelective(CourseTemplate record);

    /**
     * This method was generated by MyBatis Generator.
     * This method corresponds to the database table course_template
     *
     * @mbg.generated Thu Jul 04 11:26:06 CST 2019
     */
    @Update({
        "update course_template",
        "set template_name = #{templateName,jdbcType=VARCHAR},",
          "course_id = #{courseId,jdbcType=CHAR},",
          "course_name = #{courseName,jdbcType=VARCHAR},",
          "level_id = #{levelId,jdbcType=CHAR},",
          "level_name = #{levelName,jdbcType=VARCHAR},",
          "course_type = #{courseType,jdbcType=VARCHAR},",
          "min_age = #{minAge,jdbcType=INTEGER},",
          "max_age = #{maxAge,jdbcType=INTEGER},",
          "course_period = #{coursePeriod,jdbcType=INTEGER},",
          "course_book = #{courseBook,jdbcType=VARCHAR},",
          "course_valid = #{courseValid,jdbcType=INTEGER}",
        "where template_id = #{templateId,jdbcType=CHAR}"
    })
    int updateByPrimaryKey(CourseTemplate record);
}